﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<skags.Models.ForumCatViewModel>" %>

<% using (Html.BeginForm()) {%>
        <%: Html.ValidationSummary(true) %>

        <fieldset>
            <legend><%= ViewData["CategoryName"] %></legend>
          
           <div class="editor-label">
                Flokkur
            </div>
            <br />
            <div class="editor-field">

                             <select name="CategoryID">
            
            <% foreach (var s in Model.Categories){%>
                <% if (s.Title != "Stjórnendaspjall" || HttpContext.Current.User.IsInRole("Admin")) {%>
                    <option value="<%= s.ID %>"<%= s.ID == (int)ViewData["CategoryID"] ? "selected" : "" %>><%: s.Title %></option>
                        <%}%>
                        <%}%>
                  
            </select>  
               
            <br />
            <div class="editor-label">
                Titill
            </div>
            <div class="editor-label">
                <%: Html.TextBoxFor(model => model.Title) %>
                <%: Html.ValidationMessageFor(model => model.Title) %>
            </div>
            <br />
            <div class="editor-label">
                Texti
            </div>
            <div class="editor-field">
                <%: Html.ValidationMessageFor(model => model.ThreadText) %>
                <%: Html.TextAreaFor(model => model.ThreadText, new { cols = 60, rows = 20 }) %>
            </div>
            
            <p>
                <input type="submit" value="Vista" />
            </p>
        </fieldset>

    <% } %>

    <div>
        <%: Html.ActionLink("Aftur á Spjallborð", "Index") %>
    </div>

